//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
// 			VisualNovelToolkit		     /_/_/_/_/_/_/_/_/_/.
// Copyright ©2013 - Sol-tribe.	/_/_/_/_/_/_/_/_/_/.
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/.
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

[ CustomEditor(typeof(LoadImageNode))]
public class LoadImageNodeInspector : Editor {
	
#if false	
	private Texture2D previewImage;	
	
	/// <summary>
	/// Raises the enable event.
	/// </summary>
	void OnEnable(){
		string resPath = ( target as LoadImageNode ).resourceAssetPath;
		if( ! string.IsNullOrEmpty( resPath ) ){
			previewImage = AssetDatabase.LoadAssetAtPath( resPath , typeof( Texture2D ) ) as Texture2D;
		}
	}
#endif

	/// <summary>
	/// Raises the inspector GU event.
	/// </summary>
	public override void OnInspectorGUI(){
#if false
		DrawDefaultInspector();
#else		
		LoadImageNode node =target as LoadImageNode;		
		
//		EditorGUILayout.LabelField( "It is required the texture is in Resources Folder." );		

//		EditorGUILayout.BeginHorizontal();		

//			previewImage = EditorGUILayout.ObjectField( previewImage , typeof( Texture2D ) , false , GUILayout.Width( 64f ) , GUILayout.Height ( 64f ) ) as Texture2D;		

//			EditorGUILayout.BeginVertical();
//			EditorGUILayout.HelpBox( "Please select from Resources folder." , MessageType.Info , true );
			
//			EditorGUILayout.SelectableLabel( node.anyResourcePath  );
/*			if( previewImage != null ){
				node.resourceAssetPath = AssetDatabase.GetAssetPath( previewImage );		
//				EditorGUILayout.SelectableLabel( AssetDatabase.GetAssetPath( previewImage )  );
			}
//*/
			node.targetObject = EditorGUILayout.ObjectField( "Target" , node.targetObject , typeof(GameObject) , true   ) as GameObject;					
			node.anyResourcePath = EditorGUILayout.TextField( "ResourcePath" , node.anyResourcePath );
//			node.position = EditorGUILayout.RectField( "position" , node.position );
//			EditorGUILayout.EndVertical();	

//		EditorGUILayout.EndHorizontal();
/*
		if( ! string.IsNullOrEmpty( node.anyResourcePath ) ){
			node.anyResourcePath = node.anyResourcePath.Replace( Application.dataPath , "" );
			Debug.Log ( "Replaced:" + node.anyResourcePath ) ;
		}
//*/		
		if( node.targetObject != null ){
			node.m_TargetObjectName = node.targetObject.name;
		}
		else{
			node.m_TargetObjectName = "";
		}
#endif		
	}
	
}
